<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/view/include/taglib.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<meta name="applicable-device" content="mobile">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="format-detection" content="telephone=no">
	<meta http-equiv="Expires" content="-1">
	<meta http-equiv="Cache-Control" content="no-cache">
	<meta name="application-name" content="">
	<link rel="stylesheet" href="${project}/ds/css/public.css"></link>
	<link rel="stylesheet" href="${project}/ds/css/index.css"></link>
	<link href="${project}/ds/css/swiper.min.css" type="text/css" rel="stylesheet"></link>
	 <!--弹出引用样式--><link rel="stylesheet" href="${project}/ds/css/slideAlert.css"></link> <!--弹出引用样式结束-->
	<script type="text/javascript" src="${project}/ds/js/jquery-1.8.3.min.js"></script>
	<!--弹出引用js--><script type="text/javascript" src="${project}/ds/js/zepto.min.js"></script>
	<script type="text/javascript" src="${project}/ds/js/slideAlert.js"></script><!--弹出引用js结束-->
	<script type="text/javascript">
	$(function (){
		countTime();
	})
	 function countTime() {  
         //获取当前时间  
         var date = new Date();  
         var now = date.getTime();  
         //设置截止时间  
         var str="${StartTime}";
         var endDate = new Date(str); 
         var end = endDate.getTime();  
         
         //时间差  
         var leftTime = end-now; 
         //定义变量 d,h,m,s保存倒计时的时间  
         var h,m,s;  
         if (leftTime>=0) {  
             h = Math.floor(leftTime/1000/60/60);  
             m = Math.floor(leftTime/1000/60%60);  
             s = Math.floor(leftTime/1000%60);                     
         }  
         //将倒计时赋值到div中  
         $(".RemainH").html(h);
         $(".RemainM").html(m);
         $(".RemainS").html(s);
        
         //递归每秒调用countTime方法，显示动态时间效果  
         setTimeout(countTime,1000); 
     }  
    </script>
    <script type="text/javascript">
      $(function(){
    	  $("#shoucang").click(function(){
    		  $.post("/shoucang/doShouCang", { "id": ${fangyuan.id} },
    				   function(data){
    				     alert(data.msg); 
    				     if(data.result==="true"){
    				    	 var count = ${fangyuan.dCollectionCount};
    				    	 var addCount = Number(count)+1;
    				    	 $("#shouCangCount").html(addCount);
    				     }
    				     
    				   }, "json");
    	  })
      })
      function shoucang(){
    	  $.post("/shoucang/doShouCang", { "id": ${fangyuan.id} },
				   function(data){
				     alert(data.msg); 
				     if(data.result==="true"){
				    	 var count = ${fangyuan.dCollectionCount};
				    	 var addCount = Number(count)+1;
				    	 $("#shouCangCount").html(addCount);
				     }
				     
				   }, "json");
      }
      function goBuy(id){
    		  $.post("/fangyuan/buyRoom", { "id": ${fangyuan.id}},
    				   function(data){
    				     //alert(data.msg.D_BanName); 
    				     if(data.result==="true"){
    				    	 window.location.href="/fangyuan/buyRoomForSuccess?id="+id;
    				     }else{
    				    	 window.location.href="/fangyuan/buyRoomForFail";
    				    	 /* $("#yxfy").html(data.msg.D_BanName+"-"+data.msg.D_Unit+"-"+data.msg.D_RoomNo);
    				    	 showFalse(); */
    				     }   				     
    			}, "json"); 	  
      }
    </script>
	<style type="text/css">
		.swiper-slide {
			text-align: right;
			font-size: 18px;
			background:#fff;
    	}
		.swiper-slide img{width:100%}
	</style>
</head>
<body>
	<div class="center">
		<div class="b-index-w" style="padding-top:48px;padding-bottom:46px;">
			<nav class="menunav">
				<div class="menunav-w">
						<div class="nav-list navon">
						  <a href="/fangyuan"><p class="f-n1"></p><span class="f-n-name">房源列表</span></a>
						</div>
						<div class="nav-list">
						  <a href="/dingdan"><p class="f-n2"></p><span class="f-n-name">我的订单</span></a>
						</div>
						<div class="nav-list">
						  <a href="/shoucang"><p class="f-n3"></p><span class="f-n-name">我的收藏</span></a>
						</div>
				</div>
			</nav>
			<div class="sub-dd clearfix">
				<div class="sub-d-left">公告</div>
				<div class="sub-d-right">
					<div class="subtimer">
						 <span class="RemainH Remain">0</span><span class="liksapn">时</span><span class="RemainM Remain">0</span><span class="liksapn">分</span><span class="RemainS Remain">0</span><span class="liksapn">秒后活动结束</span>
					</div>
				</div>
			</div>
			<div>
			 <div class="swiper-container">
				<div class="swiper-wrapper">
					<div class="swiper-slide"><img src="${project}/ds/images/33.jpg"></div>
					<div class="swiper-slide"><img src="${project}/ds/images/33.jpg"></div>
					<div class="swiper-slide"><img src="${project}/ds/images/33.jpg"></div>
					<div class="swiper-slide"><img src="${project}/ds/images/33.jpg"></div>
				</div>
				<div class="swiper-pagination"></div>
			 </div>
			<div class="fy-c-w clearfix">
				<div class="fy-c-left">
					<p class="c-left-name1">${fangyuan.getD_BanName()}${fangyuan.getD_Unit()}${fangyuan.getD_RoomNo()}</p>
					<!-- <p class="c-left-name2">中梁宝龙于康新盘3期</p> -->
				</div>
				<div class="fy-c-right">
					<p id="shouCangCount">${fangyuan.getD_CollectionCount()+fangyuan.getE_CollectionCount()}</p>
				</div>
			</div>
			<div class="p-w-l">
				<div class="w-l-list clearfix">
					<div class="l-list-left">面积：</div>
					<div class="l-list-right">${fangyuan.getD_FloorArea()}平方米</div>
				</div>
				<c:choose>
	                           <c:when  test="${IsShowPrice==1}">
									<div class="w-l-list clearfix">
										<div class="l-list-left">总价：</div>
										<div class="l-list-right"><span class="bj-zj">${fangyuan.getD_Total()}万</span></div>
									</div>
	                           </c:when >
	                           <c:otherwise>
                           			<div class="w-l-list clearfix">
										<div class="l-list-left">总价：</div>
										<div class="l-list-right"><span class="bj-zj">******万</span></div>
									</div>
                           		</c:otherwise>
                           </c:choose>
				<div class="w-l-list clearfix">
					<div class="l-list-left">类型：</div>
					<div class="l-list-right">${fangyuan.getD_RoomType()}</div>
				</div>
			</div>
			<div class="b_buttons clearfix">
				<a href="javascript:void(0);" class="buttons3" id="shoucang" onclick="shoucang()"><span>收藏</span></a>
				<button class="J-ac-btn" data-type="alert"/>立即选择</button>
			</div>
			 <!--弹出按钮--><!--弹出按钮结束-->
			 <!--弹出内容-->
			 <div id="J-alert" style="display:none">
			 	<div class="i-dc-w" style="padding-bottom:15px;">
					<h3>确认订单</h3>
					<div class="dd-w-cont">
						<div class="dd-w-w">
							<div class="dd-w-list clearfix">
								<div class="d-w-list-left">房号：</div>
								<div class="d-w-list-left">${fangyuan.getD_BanName()}${fangyuan.getD_Unit()}${fangyuan.getD_RoomNo()}</div>
							</div>
							<div class="dd-w-list clearfix">
								<div class="d-w-list-left">总价：</div>
								<div class="d-w-list-left">${fangyuan.getD_Total()}万</div>
							</div>
							<div class="dd-w-list clearfix">
								<div class="d-w-list-left">类型：</div>
								<div class="d-w-list-left">${fangyuan.getD_RoomType()}</div>
							</div>
						</div>
						<div class="dd-w-w">
							<div class="dd-w-list clearfix">
								<div class="d-w-list-left">客户：</div>
								<div class="d-w-list-left">${user.realName}</div>
							</div>
							<div class="dd-w-list clearfix">
								<div class="d-w-list-left">手机号码：</div>
								<div class="d-w-list-left">${user.userName}</div>
							</div>
							<div class="dd-w-list clearfix">
								<div class="d-w-list-left">身份证号：</div>
								<div class="d-w-list-left">${user.userCode}</div>
							</div>
							<!-- <div class="dd-w-list clearfix">
								<div class="d-w-list-left">身份证号：</div>
								<div class="d-w-list-left">4104225478941122</div>
							</div>
							<div class="dd-w-list clearfix">
								<div class="d-w-list-left">身份证号：</div>
								<div class="d-w-list-left">4104225478941122</div>
							</div> -->
						</div>
						<div class="dd-w-w">
							<div class="dd-w-list clearfix">
								<div class="d-w-list-left d-w-list-left-img"></div>
								<div class="d-w-list-left d-w-list-left-margin">本人已阅读并同意微信选房须知</div>
							</div>
						</div>
						<div class="s_buttons clearfix">
							<a href="javascript:void(0);" class="buttons5" onclick="closeSure()">取消</a>
							<button class="buttons6" onclick="goBuy(${fangyuan.getD_ID()})" id="buy">确认</button>
						</div>
					</div>
				</div>
			</div>
			 <!--弹出内容结束-->
			 <!--弹出js-->
			<script type="text/javascript">
				$(".J-ac-btn").click(function(){
				   var type = $(this).attr('data-type');
				   var instance = $(this).slideAlert({
					   type: type,
					   content: $('#J-' + type).html(),
					   beforeOpen: function () {
						   console.log('before open callback');
					   },
					   afterClose: function () {
						   console.log('after close callback');
					   },
					   afterOpen: function () {
							
					   }
				   });
				});
			</script>			
			<script type="text/javascript" src="${project}/ds/js/swiper.jquery.min.js"></script>
			<script type="text/javascript">
				var swiper = new Swiper('.swiper-container', {
					autoplay: true,
					pagination: '.swiper-pagination',
					paginationType: 'fraction',
					autoplay : 3000,
					loop:true
				});
			</script>
			 <!--弹出js结束-->
			</div>
		</div>
	</div>
</body>
</html>